<?php require_once('Connections/mysql_admin.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO registo_normal (usuario_normal, password_normal) VALUES (%s, %s)",
                       GetSQLValueString($_POST['user_normal'], "text"),
                       GetSQLValueString($_POST['pass_normal'], "text"));

  mysql_select_db($database_mysql_admin, $mysql_admin);
  $Result1 = mysql_query($insertSQL, $mysql_admin) or die(mysql_error());

  $insertGoTo = "painel_admin_sucesso.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>LSecurity</title>
<style type="text/css">
<!--
body {
	background-color: #3399FF;
}
-->
</style>
<style type="text/css">
<!--
.style2 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12px;
}
-->
</style>
<style type="text/css">
<!--
.style11 {font-family: Verdana, Arial, Helvetica, sans-serif}
-->
</style>

<style type="text/css">
<!--
.style14 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9px; }
.style16 {font-size: 16px}
-->
</style>
<script src="SpryAssets/SpryAccordion.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="SpryAssets/SpryAccordion.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style17 {font-size: 10px}
-->
</style>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style19 {
	color: #FFFFFF;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12px;
}
-->
</style>
</head>

<body>
<div align="center">
  <p><img src="index.gif" width="400" height="150" /><br />
    <span class="style2  style16"><strong>-&gt; Painel de Admin</strong></span></p>
  <p class="AccordionPanelTab style19"><strong>Conta Criada com sucesso!</strong></p>
</div>
<table width="869" height="112" border="0" align="center">
  <tr>
    <td width="870"><table width="870" border="0" align="center">
      <tr></tr>
    </table>
      <div id="Accordion1" class="Accordion" tabindex="0">
        <div class="AccordionPanel">
          <div class="AccordionPanelTab style11 style17">Criação de Contas Normais</div>
          <div class="AccordionPanelContent style11 style17">
            <form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>">
              <label>
              <div align="center">
                <p>&nbsp;</p>
                <p>Usuário:<br />
                  <span id="sprytextfield1">
                  <input type="text" name="user_normal" id="user_normal" />
                <span class="textfieldRequiredMsg">Obrigatorio!</span></span></p>
              </div>
              </label>
              <div align="center"><br />
                Password:<br />  
              </div>
              <label>
              <div align="center"><span id="sprytextfield2">
                <input type="text" name="pass_normal" id="pass_normal" />
                <span class="textfieldRequiredMsg">Obrigatorio!</span></span><br />
                <br />
                <input type="submit" name="criar" id="criar" value="Criar" />
              </div>
              </label>
              <input type="hidden" name="MM_insert" value="form1" />
            </form>
          </div>
        </div>
      </div>
      <p align="center" class="style14">Feito por Deluxor 2007</p>
    </td>
  </tr>
</table>
<table width="870" border="0" align="center">
  <tr></tr>
</table>
<script type="text/javascript">
<!--
var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3");
var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4");
var Accordion1 = new Spry.Widget.Accordion("Accordion1");
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
//-->
</script>
</body>
</html>
